package com.fc.mapper;


import com.fc.model.ShareBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


/**
 * Created by chenyan on 16/5/30.
 */
@Repository
public interface OrderInfoDao {

    void insertId(@Param("openId") String openId, @Param("parentId") String parentId, @Param("shareState") int shareState);

    void insertUserActivity(@Param("openId") String openId, @Param("activityId") int activityId, @Param("shareState") int shareState, @Param("redEnvelope") double redEnvelope);

    void keepUserInfo(@Param("openId") String openId,
                      @Param("nickname") String nickname,
                      @Param("sex") String sex,
                      @Param("language") String language,
                      @Param("city") String city,
                      @Param("province") String province,
                      @Param("country") String country,
                      @Param("headimgurl") String headimgurl);

    @Select("SELECT count(*) FROM userinfo WHERE openid=#{openId}")
    int isUserInfoHave(@Param("openId") String openId);


    ShareBean selectUserActivity(@Param("openId") String openId, @Param("activityId") int activityId);


    ShareBean selectConnectionInfo(@Param("openId") String openId, @Param("parentId") String parentId, @Param("activityId") int activityId);

    void updateShareState(@Param("openId") String openId, @Param("parentId") String parentId, @Param("activityId") int activityId);

    void updateUserActivity(@Param("openId") String openId, @Param("activityId") int activityId, @Param("redEnvelope") double redEnvelope);
}
